
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )

function ENT:Initialize()

	self.Entity:SetName("Tiberium Chemical Warhead")
	self.Entity:SetModel( "models/items/combine_rifle_ammo01.mdl" )

	local phys = self.Entity:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
		phys:EnableGravity(false)
		phys:EnableDrag(false)
		phys:EnableCollisions(false)
	end

	self.PhysObj = self.Entity:GetPhysicsObject()
	
end

function ENT:PhysicsUpdate()

end

function ENT:Think()

	local expl=ents.Create("env_explosion")
	expl:SetPos(self.Entity:GetPos())
	expl:SetName("Missile")
	expl:SetParent(self.Entity)
	expl:SetOwner(self.Entity:GetOwner())
	expl:SetKeyValue("iMagnitude","300");
	expl:SetKeyValue("iRadiusOverride", 250)
	expl:Spawn()
	expl:Activate()
	expl:Fire("explode", "", 0)
	expl:Fire("kill","",0)
	self.Exploded = true

	local p = 0

	for p = 0, 20, 1 do
		local GSpray = ents.Create( "tibgas" )
		if ( !GSpray:IsValid() ) then return end
		GSpray:SetPos( self.Entity:GetPos() + Vector( math.random( -100, 100 ), math.random( -100, 100 ), math.random( -100, 100 ) ) )
		GSpray:Spawn()
		GSpray:SetOwner( self.Entity )
		GSpray:Fire( "kill", "", 10)
		GSpray:SetVelocity( Vector( math.random( -100, 100 ), math.random( -100, 100 ), math.random( -100, 100 ) ) )
	end

	self.Entity:Remove()
end

function ENT:PhysicsCollide( data, physobj )
	
end

function ENT:OnTakeDamage( dmginfo )
	
end

function ENT:Use( activator, caller )

end